import 'dart:convert';

import 'package:enterprise_v6_app/generated/json/base/json_field.dart';
import 'package:enterprise_v6_app/generated/json/weather_entity.g.dart';
export 'package:enterprise_v6_app/generated/json/weather_entity.g.dart';

@JsonSerializable()
class WeatherEntity {
  WeatherEntity();

  factory WeatherEntity.fromJson(Map<String, dynamic> json) => $WeatherEntityFromJson(json);
  List<WeatherLives>? lives = [];

  Map<String, dynamic> toJson() => $WeatherEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class WeatherLives {
  WeatherLives();

  factory WeatherLives.fromJson(Map<String, dynamic> json) => $WeatherLivesFromJson(json);

  ///省份
  String? province = '';

  ///城市
  String? city = '';

  ///区域编码
  String? adcode = '';

  ///天气现象(汉字描述)
  String? weather = '';

  ///实时温度，单位：摄氏度
  String? temperature = '';

  ///风向描述
  String? winddirection = '';

  ///风力级别
  String? windpower = '';

  ///空气湿度
  String? humidity = '';

  ///数据发布时间
  String? reporttime = '';

  @JSONField(name: 'temperature_float')
  String? temperatureFloat = '';
  @JSONField(name: 'humidity_float')
  String? humidityFloat = '';

  Map<String, dynamic> toJson() => $WeatherLivesToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
